package main.java.Fzy.designMode.single;

/**
* @author LazyCat
* @date  2022/10/3
* @param
* @return
 * 懒汉式单例(线程安全)
*/
public class Single1 {

//    private static Single1 single1;
//
//    private Single1(){}
//
//    public static synchronized Single1 getInstance(){
//        if(single1 == null){
//            single1 = new Single1();
//        }
//        return single1;
//    }

    private static Single1 single1;

    private Single1(){

    }

    public static synchronized Single1 getInstance(){

        if(single1 == null){
            single1 = new Single1();
        }
        return single1;
    }

}
